package com.fingerchar.core.util;

import java.util.Arrays;

/**
 * @author tangzf
 * @date 2022/9/7
 */
public class ToolUtils {

    public static String getRandom(){
        char[] letters = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
                '0','1','2','3','4','5','6','7','8','9'};
        boolean[] flags = new boolean[letters.length];
        char[] cha = new char[6];
        for (int i = 0; i < cha.length; i++) {
            int index;
            do {
                index = (int) (Math.random()*(letters.length));
            }while (flags[index]);//判断生成的字符串是否重复
            cha[i] = letters[index];
            flags[index] = true;
        }
        return Arrays.toString(cha);
    }

}
